package com.burst.reptile.modular.zp.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.burst.reptile.modular.api.vo.BaseUser;
import com.burst.reptile.modular.api.vo.ReplyVo;

import java.time.LocalDateTime;
import java.util.List;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * <p>
 * 评论列表
 * </p>
 *
 * @author wujin
 * @since 2020-06-30
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("zp_comment")
public class ZpComment implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    @TableId(value = "cid", type = IdType.AUTO)
    private Long cid;

    /**
     * 文章id
     */
    @NotNull(message = "评论文章不能为空")
    private Long articleId;

    /**
     * 用户ID
     */
    private Long userId;

    /**
     * 评论还是回复 0 评论 1 回复
     */
    private String ctype;

    /**
     * 内容
     */
    @NotBlank(message = "内容不能为空")
	@Size(min = 0, max = 100, message = "内容长度不能超过100个字符")
    private String content;

    /**
     * 回复用户ID
     */
    private Long touserId;

    /**
     * 回复评论ID或回复回复的ID
     */
    private Long pcid;
    
    /**
     * 所属评论ID
     */
    private Long acid;
    
    /**
     * 评论内容
     */
    private String tcontent;

    /**
     * 点赞量
     */
    private Integer likes;

    /**
     * 创建用户
     */
    @TableField(fill = FieldFill.INSERT)
    private String createUser;

    /**
     * 评论及回复时间
     */
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;
    
    /**
     * 回复数量
     */
    @TableField(exist = false)
    private Integer replyNum;
    
    /**
     * 回复列表
     */
    @TableField(exist = false)
    private List<ReplyVo> replyVos;

    /**
     * 评论用户信息
     */
    @TableField(exist = false)
    private BaseUser user;
    
    /**
     * 是否点赞
     */
    @TableField(exist = false)
    private boolean support;
    
    /**
     * 是否是自己
     */
    @TableField(exist = false)
    private boolean own;
    
    /**
     * 时间个性化
     */
    @TableField(exist = false)
    private String time;
    
    /**
     * 内容信息
     */
    @TableField(exist = false)
    private ZpResources res;

}
